From 52956401df7497f3f51e3bd164ce2bb0a5cc2ee1 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Wed, 11 Feb 2015 17:17:38 +0100 Subject: [PATCH] x86/traps: avoid interleaved writes when updating potentially-live descriptors Signed-off-by: Andrew Cooper --- xen/include/asm-x86/processor.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 2773ea8101..c5c647a1c4 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -444,9 +444,12 @@ struct __packed __cacheline_aligned tss_struct { * descriptor table entry. */ static always_inline void set_ist(idt_entry_t *idt, unsigned long ist) { + idt_entry_t new = *idt; + /* IST is a 3 bit field, 32 bits into the IDT entry. */ ASSERT(ist <= IST_MAX); - idt->a = (idt->a & ~(7UL << 32)) | (ist << 32); + new.a = (idt->a & ~(7UL << 32)) | (ist << 32); + _write_gate_lower(idt, &new); } #define IDT_ENTRIES 256 -- 2.30.2